/**
 * Created by IAN on 2016/10/14.
 */
$(function () {
    //添加信息
    $("#eid").val(getUUID());
    $("#topTime").val("0");
    $("#addData").on("click",function(){
        $("#addForm").attr("action",getIP()+"discuss/uploadImg");
        $("#addForm").submit();
    })

    //取消修改信息
    $("#cancelAdd").on("click",function() {
        history.back(-1);
    })

    //实时预览图片
    $("#loadImg").on("change", function(e){
        var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
        for (var i = 0, len = files.length; i < len; ++i) {
            var file = files[i];

            if (url) {
                src = url.createObjectURL(file);
            } else {
                src = e.target.result;
            }

            $("#pUrl").attr('src', src);
        }
    });
});